package com.ycsj.goldmedalnewconcept.teacher.adapter;

import android.content.Context;
import android.content.Intent;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ycsj.goldmedalnewconcept.R;
import com.ycsj.goldmedalnewconcept.teacher.activity.TeacherScoreDetailsActivity;
import com.ycsj.goldmedalnewconcept.teacher.bean.ScoreInfo;

import java.util.List;

/**
 * 成绩管理的适配器
 * Created by Administrator on 2018/6/28 0028.
 */

public class ScoreRvAdapter extends BaseQuickAdapter<ScoreInfo.DataBean, BaseViewHolder> {
    private Context context;

    public ScoreRvAdapter(Context context, int layoutResId, @Nullable List<ScoreInfo.DataBean> data) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, final ScoreInfo.DataBean item) {
        //考试名称
        TextView tvName = helper.getView(R.id.tv_name);
        tvName.setText(item.getTAG());
        //考试时间
        TextView tvTime = helper.getView(R.id.tv_time);
        tvTime.setText(item.getTIME());
        RelativeLayout rl_look_details = helper.getView(R.id.rl_look_details);
        rl_look_details.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到成绩详情界面
                Intent intent = new Intent(context, TeacherScoreDetailsActivity.class);
                //携带班级号和Tag过去
                intent.putExtra("classnum", item.getUSER_CLASS() + "");
                intent.putExtra("tagid", item.getROW_ID() + "");
                intent.putExtra("title", item.getTAG() + "");
                context.startActivity(intent);
            }
        });
    }
}
